@echo off
set tmpstr= %date%%time%
for /F %%i in ('netstat -an^|find "TCP" /c') do ( set TCP=%%i)
for /F %%i in ('netstat -an^|find "CLOSED" /c') do ( set CLOSED=%%i)
for /F %%i in ('netstat -an^|find "LISTEN" /c') do ( set LISTEN=%%i)
for /F %%i in ('netstat -an^|find "SYN_RECV" /c') do ( set SYN_RECV=%%i)
for /F %%i in ('netstat -an^|find "SYN_SENT" /c') do ( set SYN_SENT=%%i)
for /F %%i in ('netstat -an^|find "ESTABLISHED" /c') do ( set ESTABLISHED=%%i)
for /F %%i in ('netstat -an^|find "TIME_WAIT" /c') do ( set TIME_WAIT=%%i)
set tmpstr=%tmpstr% TCP:%TCP% CLOSED:%CLOSED% LISTEN:%LISTEN% SYN_RECV:%SYN_RECV% SYN_SENT:%SYN_SENT% ESTABLISHED:%ESTABLISHED% TIME_WAIT:%TIME_WAIT%
echo %tmpstr%